<?php

namespace app\common\logic;

use think\Model;

class Menu extends Model
{
    public function addItem($data)
    {
        $ret = $this->allowField(true)->isUpdate(false)->save($data);
        return $ret;
    }

    public function updateItem($data, $where)
    {
        $ret = $this->allowField(true)->isUpdate(true)->save($data, $where);
        return $ret;
    }

    public static function getList($where, $field = "*", $order = "sort")
    {
        $rows = empty(input('rows')) ? config('paginate.list_rows') : input('rows');
        $list = self::where($where)->order($order)->field($field)->paginate($rows);
        $ret = $list->render();
        return $ret;
    }


}